home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / src / libgplus.5 / libgplus / etc / graph / egetopt.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-28  |  562 b   |  44 lines

  1. #pragma implementation
  2. #include "eGetOpt.h"
  3.   
  4. int
  5. eGetOpt :: next_arg (int &i)
  6. {
  7.   int tmp;
  8.   if (0 < sscanf (nargv[optind], "%d", &tmp))
  9.     {
  10.       i = tmp;
  11.       optind++;
  12.       return 1;
  13.     }
  14.   else
  15.     return 0;
  16. }
  17.  
  18. int
  19. eGetOpt :: next_arg (double &d)
  20. {
  21.   double tmp;
  22.   if (0 < sscanf (nargv[optind], "%lf", &tmp))
  23.     {
  24.       d = tmp;
  25.       optind++;
  26.       return 1;
  27.     }
  28.   else
  29.     return 0;
  30. }
  31.  
  32. int
  33. eGetOpt :: next_arg (String &s)
  34. {
  35.   if ('-' != nargv[optind][0])
  36.     {
  37.       s = nargv[optind];
  38.       optind++;
  39.       return 1;
  40.     }
  41.   else
  42.     return 0;
  43. }
  44.